<html>
<head>
  <script type='text/javascript' src='../../lib/countly.js'></script>
  <script type='module'>
    import { queryExtractor } from '../support/integration_helper.js';

    // here we implement a cookie and localStorage clearing logic
    const deleteAllCookies = () => {
      const cookies = document.cookie.split(";");
      for (const cookie of cookies) {
        const eqPos = cookie.indexOf("=");
        const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
        document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
      }
    }
    window.localStorage.clear();
    deleteAllCookies();
    console.error("cleared the storage");
    var domEl = queryExtractor(window.location.search).dom;
    Countly.init({
      app_key: "YOUR_APP_KEY",
      url: "https://your.domain.countly",
      debug: true,
      test_mode: true
    })
    Countly.track_sessions();
    Countly.track_pageview();
    window.onload = function () {
      Countly.track_clicks(document.getElementById(domEl));
    };
  </script>
</head>
<body>
  <input type="button" id="click" onclick="" value="Click Me">
  <input type="button" id="click2" onclick="" value="Click Me">
  <input type="button" id="click3" onclick="" value="Click Me">
  <input type="button" id="click4" onclick="" value="Click Me">
  <input type="button" id="click5" onclick="" value="Click Me">
</body>
</html>